package jvm.demo003;

public class HeapSpaceTest {
    public static void main(String[] args) throws InterruptedException {
        // 返回Java虚拟机中堆内存总量(默认是字节)
        long initialMemory = Runtime.getRuntime().totalMemory()/1024/1024;
        // 返回Java虚拟机试图使用的最大堆内存
        long maxMemory = Runtime.getRuntime().maxMemory()/1024/1024;
        System.out.println("初始内存空间 -Xms: "+initialMemory+ "M");//243M
        System.out.println("最大内存空间 -Xmx: "+maxMemory+ "M");//3607M

        System.out.println("系统内存大小："+initialMemory * 64.0 / 1024 +"G");//15.1875G
        System.out.println("系统内存大小："+maxMemory * 4.0 / 1024 +"G");//14.08984375G

        Thread.sleep(1000000);

    }

}
